require('dotenv').config()

const Q = require('./index');
let queueConfig = {
    host: '200.200.192.20',
    port: 6379,
    password: "a.123456"
}









Q.init(queueConfig).then( async queue => {
    
    queue.on("qw/sys_approval_change", (a) => {

        console.log("------on-----")
        console.log( a )
    
    })
    

    queue.emit("qw/sys_approval_change",{
        "creator_userid": "QiuYouLong",
        "template_id": "3WK7BUZfUufqCq9CyNxzdc4V6LcBvx6qzopw24gC",
        "use_template_approver": 1,
        "apply_data": {
            "contents": [
                {
                    "control": "Tips",
                    "id": "Tips-1636473416244"
                }
            ]
        },
        "summary_list": [
            {
                "summary_info": [
                    {
                        "text": "摘要第1行",
                        "lang": "zh_CN"
                    }
                ]
            },
            {
                "summary_info": [
                    {
                        "text": "摘要第2行",
                        "lang": "zh_CN"
                    }
                ]
            },
            {
                "summary_info": [
                    {
                        "text": "摘要第3行",
                        "lang": "zh_CN"
                    }
                ]
            }
        ]
    }, { i: "info1" })
})


/*
setTimeout(() => {
    console.log("------emit-----")

    queue.emit("qw/sys_approval_change",{
        "creator_userid": "QiuYouLong",
        "template_id": "3WK7BUZfUufqCq9CyNxzdc4V6LcBvx6qzopw24gC",
        "use_template_approver": 1,
        "apply_data": {
            "contents": [
                {
                    "control": "Tips",
                    "id": "Tips-1636473416244"
                }
            ]
        },
        "summary_list": [
            {
                "summary_info": [
                    {
                        "text": "摘要第1行",
                        "lang": "zh_CN"
                    }
                ]
            },
            {
                "summary_info": [
                    {
                        "text": "摘要第2行",
                        "lang": "zh_CN"
                    }
                ]
            },
            {
                "summary_info": [
                    {
                        "text": "摘要第3行",
                        "lang": "zh_CN"
                    }
                ]
            }
        ]
    }, { i: "info1" })

}, 2000)
*/